<?php
header('content-type:text/html;charset=utf8');
$uid=$_POST['uid'];
$cid=$_POST['cid'];
$title=$_POST['title'];
$photo=$_POST['photo'];
$datetime=time();
$describe=$_POST['describe'];
$label=$_POST['label'];
$status=$_POST['status'];

$link =@mysql_connect('127.0.0.1','root','root');
if(!$link){
    die('连接失败，错误号为：'.mysql_errno().'失败原因：'.mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');


$sql = "insert into `article`(`uid`,`cid`,`title`,`photo`,`datetime`,`describe`,`label`,`status`) values('$uid','$cid','$title','$photo','$datetime','$describe','$label','$status')";
$res = mysql_query($sql) or mysql_error();


if($res){
    echo '<script>alert("新增成功");window.location.href="/admin/cate/index.php"</script>';
}else{
    echo '<script>alert("新增失败");window.location.href="/admin/cate/index.php"</script>';
}
mysql_close();
?>